﻿<%@ Page Language="C#" MasterPageFile="~/JOINT/MstPage_JOINT.master" AutoEventWireup="true" 
    CodeFile="frmJ_TraineeListSelect.aspx.cs" Inherits="JOINT_frmJ_TraineeListSelect" 
    Title="Untitled Page" Culture="ja-JP" uiCulture="ja" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
候補者選択</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">

    <script src="../js/jquery-1.4.1.min.js" type="text/javascript"></script>
    <script language="javascript" type ="text/javascript" >
    function SelectAllCheckboxes(spanChk) {

        // Added as ASPX uses SPAN for checkbox
        var oItem = spanChk.children;
        var theBox = (spanChk.type == "checkbox") ?
        spanChk : spanChk.children.item[0];
        xState = theBox.checked;
        elm = theBox.form.elements;

        for (i = 0; i < elm.length; i++)
            if (elm[i].type == "checkbox" &&
              elm[i].id != theBox.id) {
            //elm[i].click();
            if (elm[i].checked != xState)
                elm[i].click();
            //elm[i].checked=xState;
        }
    }

    function CountCheck(element) {
        var count = parseInt($('#<%= hdCount.ClientID %>').val());
        var check = parseInt($('#<%= hdCheck.ClientID %>').val());
        var gridview = document.getElementById('<%= grv.ClientID %>');
        var chk = element.firstChild;
        if (chk.checked == true) {
            count += 1;
            check += 1;
        }
        else {
            count -= 1;
            check -= 1;
        }
        //alert(check);
        var Countdt = document.getElementById('ctl00_ContentPlaceHolder1_hdCountGrv').value
        var Totalpage = parseInt(Countdt % 10);
        if (Totalpage != 0) {
            Totalpage = parseInt((Countdt / 10) + 1);
        }
        if (Countdt > 10) {
            var hdPageIndex = parseInt($('#<%= hdPageIndex.ClientID %>').val());
            if (hdPageIndex + 1 == Totalpage) {
                if (gridview.rows.length - 2 == check) {
                    document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = true;
                }
                else {
                    document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = false;
                }
            }
            else {
                if (gridview.rows.length - 2 == check) {
                    document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = true;
                }
                else {
                    document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = false;
                }
            }
        }
        else {
            if (gridview.rows.length - 1 == check) {
                document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = true;
            }
            else {
                document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = false;
            }
        }
        $('#<%= hdCount.ClientID %>').val(count);
        $('#<%= hdCheck.ClientID %>').val(check);
        $('#<%= lblCount.ClientID %>').html(count);
    }

    $(document).ready(function() {
        $(".mGrid tr input[type=checkbox]").each(function() {
            var chk = $(this);
            changeBGwhenCheck(chk);
        })
        $(".mGrid input[type=checkbox]").click(function() {
            var chk = $(this);
            changeBGwhenCheck(chk);
        })
        $('#<%= lblCount.ClientID %>').html($('#<%= hdCount.ClientID %>').val());
        var gridview = document.getElementById('<%= grv.ClientID %>');
        var check = parseInt($('#<%= hdCheck.ClientID %>').val());
        var Countdt = document.getElementById('ctl00_ContentPlaceHolder1_hdCountGrv').value
        if (Countdt > 10) {
            if (gridview.rows.length - 2 == check) {
                document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = true;
            }
            else {
                document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = false;
            }
        }
        else {
            if (gridview.rows.length - 1 == check) {
                document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = true;
            }
            else {
                document.getElementById('ctl00_ContentPlaceHolder1_grv_ctl01_ckb_全て選択').checked = false;
            }
        }
    })
    function changeBGwhenCheck(chk) {
        if (chk.is(':checked') == true) {
            chk.parents(".mGrid tr").addClass("checked1");
            chk.parents(".mGrid .alt").addClass("checked2");
            chk.parents(".mGrid .alt").removeClass("alt");
        }
        else {
            chk.parents(".mGrid tr").removeClass("checked1");
            chk.parents(".mGrid .checked2").addClass("alt");
            chk.parents(".mGrid .checked2").removeClass("checked2");
        }
    }
    </script>

<div class="maindiv1"  >
    <asp:HiddenField ID="hdCount" runat="server" />
    <asp:HiddenField ID="hdCheck" runat="server" />
    <asp:HiddenField ID="hdPageIndex" runat="server" />
    <asp:HiddenField ID="hdCountGrv" runat="server" />
    <div  class="div_content" >
        <span style="color: Gray; padding-left: 20px">
            <asp:Label ID="lbl_CongTy" runat="server"></asp:Label>
            </span>
        <br />
        <div class="detail-admin-row">
            <center>
                現在
                <asp:Label ID="lblCount" runat="server"> </asp:Label>
                人を選択しました
            </center>
        </div>
        <br />
        <div  style="width:740px; float:left; overflow:scroll">
            <%-- <asp:CheckBox 
                ID="ckb_全て選択" 
                runat="server" 
                Text="全て選択" 
                oncheckedchanged="ckb_全て選択_CheckedChanged" AutoPostBack="True">
            </asp:CheckBox>--%>

            <asp:GridView 
                id="grv" 
                runat="server"   
                ShowFooter="false"
                AutoGenerateColumns="False" 
                AllowPaging="true"
                PageSize="10"
                PagerStyle-CssClass="pgr" 
                AlternatingRowStyle-CssClass="alt"
                CssClass="mGrid" 
                Font-Names="MS UI Gothic"
                onpageindexchanging="grv_PageIndexChanging" 
                onrowdatabound="grv_RowDataBound" 
                onpageindexchanged="grv_PageIndexChanged">
                <Columns >
                    <asp:TemplateField HeaderText="" SortExpression="決定">
                        <HeaderTemplate>
                            <asp:CheckBox 
                                ID="ckb_全て選択" 
                                onclick="javascript:SelectAllCheckboxes(this);"
                                runat="server" 
                                Text="">
                            </asp:CheckBox>
                        </HeaderTemplate> 
                        
                        <ItemTemplate>
                            <center> 
                                <asp:CheckBox 
                                    ID="CheckBox1" 
                                    runat="server"
                                    onchange = "CountCheck(this);"
                                     />
                            </center>
                            
                        </ItemTemplate>
                      <%--  <FooterTemplate>
                            <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/Images/controls/first copy.gif"  CommandArgument="First" CommandName="Page" />
                            <asp:ImageButton ID="ImageButton2" runat="server"   ImageUrl="~/Images/controls/last copy.gif" CommandArgument="Prev" CommandName="Page"/>
                            ページ
                            <asp:DropDownList ID="ddlPages" runat="server" AutoPostBack="True" ></asp:DropDownList> 
                            / 
                            <asp:Label ID="lblPageCount" runat="server"></asp:Label>
                            <asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/Images/controls/next copy.gif"   CommandArgument="Next" CommandName="Page" />
                            <asp:ImageButton ID="ImageButton4" runat="server" ImageUrl="~/Images/controls/previous copy.gif"  CommandArgument="Last" CommandName="Page"/>
                        </FooterTemplate>--%>
                         <%--<FooterStyle HorizontalAlign="center" VerticalAlign="Middle" BorderWidth="1" BorderStyle="Solid"  BorderColor="Black" BackColor="#808080"></FooterStyle>--%>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="No.">
                        <ItemTemplate>
                            <div style="width:25px; text-align:center">
                                <asp:Label
                                    runat="server"
                                    ID="lblNo"
                                    Text='<%#Container.DataItemIndex+1 %>'>
                                </asp:Label>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                            
                   
                   <asp:TemplateField HeaderText="登録年月日">
                        <ItemTemplate>
                            <div style="width:125px; text-align:center">
                                <%#Eval("登録年月日")%>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                  
                         
                    <asp:TemplateField HeaderText="氏名">
                        <ItemTemplate>
                            <div style="width:200px;overflow:hidden;white-space:normal">
                               <asp:Label
                                    runat="server"
                                    id="lbl_氏名"
                                    Text='<%#Eval("氏名")%>'
                                    Tooltip='<%#Eval("氏名")%>' />
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="性別">
                        <ItemTemplate>
                            <div style="width:45px; text-align:center">
                                <%#Eval("性別").ToString() %>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>       
                    
                    <asp:TemplateField HeaderText="年齢">
                        <ItemTemplate>
                            <div style="width:45px; text-align:center">
                                <%#Eval("年齢")%>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>       
                    
                    <asp:TemplateField HeaderText="身長">
                        <ItemTemplate>
                            <div style="width:60px;overflow:hidden;white-space:normal; text-align:center">
                                <asp:Label
                                    runat="server"
                                    id="lbl_身長"
                                    Text='<%#Eval("身長")%>'
                                    Tooltip='<%#Eval("身長")%>' />
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>       
                    
                    <asp:TemplateField HeaderText="体重">
                        <ItemTemplate>
                             <div style="width:60px;overflow:hidden;white-space:normal;text-align:center">
                                <asp:Label
                                    runat="server"
                                    id="lbl_体重"
                                    Text='<%#Eval("体重")%>'
                                    Tooltip='<%#Eval("体重")%>' />
                            </div>
                         
                        </ItemTemplate>
                    </asp:TemplateField>       
                    
                    <asp:TemplateField HeaderText="視力">
                        <ItemTemplate>
                             <div style="width:110px;overflow:hidden;white-space:normal">
                                <asp:Label
                                    runat="server"
                                    id="lbl_視力"
                                    Text='<%#Eval("視力")%>'
                                    Tooltip='<%#Eval("視力")%>' />
                            </div>
                           
                        </ItemTemplate>
                    </asp:TemplateField>      
                    
                    <asp:TemplateField HeaderText="最終学歴">
                        <ItemTemplate>
                             <div style="width:130px;overflow:hidden;white-space:normal">
                                <asp:Label
                                    runat="server"
                                    id="lbl_最終学歴"
                                    Text='<%#Eval("最終学歴")%>'
                                    Tooltip='<%#Eval("最終学歴")%>' />
                            </div>
                            
                        </ItemTemplate>
                    </asp:TemplateField>           
                    
                    <asp:TemplateField HeaderText="在学状態">
                        <ItemTemplate>
                              <div style="width:150px;overflow:hidden;white-space:normal">
                                <asp:Label
                                    runat="server"
                                    id="lbl_在学状態"
                                    Text='<%#Eval("在学状態")%>'
                                    Tooltip='<%#Eval("在学状態")%>' />
                            </div>
                            
                        </ItemTemplate>
                    </asp:TemplateField>             
                    
                    <asp:TemplateField HeaderText="就業経験有無"> 
                        <ItemTemplate>
                            <div style="width:90px">
                                <asp:Label
                                    runat="server"
                                    id="lbl_就業経験有無"
                                    Text='<%#Eval("就業経験有無")%>'/>
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>        
                    
                    <asp:TemplateField HeaderText="経験作業名1">
                        <ItemTemplate>
                             <div style="width:150px;overflow:hidden;white-space:normal">
                                 <asp:Label
                                    runat="server"
                                    id="lbl_経験作業名1"
                                    Text='<%#ShowTextLength(Eval("経験作業名1").ToString())%>'
                                    Tooltip='<%#Eval("経験作業名1")%>' />
                                
                             </div>
                            
                        </ItemTemplate>
                    </asp:TemplateField>
                   
                    <asp:TemplateField HeaderText="経験作業名2">
                        <ItemTemplate>
                              <div style="width:150px;overflow:hidden;white-space:normal">
                                 <asp:Label
                                    runat="server"
                                    id="lbl_経験作業名2"
                                    Text='<%#ShowTextLength(Eval("経験作業名2").ToString())%>'
                                    Tooltip='<%#Eval("経験作業名2")%>' />
                                
                             </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="経験作業名3">
                        <ItemTemplate>
                             <div style="width:150px;overflow:hidden;white-space:normal">
                                 <asp:Label
                                    runat="server"
                                    id="lbl_経験作業名3"
                                    Text='<%#ShowTextLength(Eval("経験作業名3").ToString())%>'
                                    Tooltip='<%#Eval("経験作業名3")%>' />
                                
                             </div>
                            
                        </ItemTemplate>
                    </asp:TemplateField>
                  
                    <asp:TemplateField HeaderText="具体的仕事内容">
                        <ItemTemplate>
                             <div style="width:200px;overflow:hidden;white-space:normal">
                                <asp:Label
                                    runat="server"
                                    id="lbl_具体的仕事内容"
                                    Text='<%#ShowTextLength1(Eval("具体的仕事内容").ToString())%>'
                                    Tooltip='<%#Eval("具体的仕事内容")%>' />
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                   
                    
                    <asp:TemplateField HeaderText="日本語学習経験">
                        <ItemTemplate>
                            <div style="width:120px">
                                <asp:Label
                                    runat="server"
                                    id="lbl_日本語学習経験"
                                    Text='<%#Eval("日本語学習経験")%>' />
                            </div>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="現住所">
                        <ItemTemplate>
                         <div style="width:220px;overflow:hidden;white-space:normal">
                           <asp:Label
                                runat="server"
                                id="abc"
                                Text='<%#ShowTextLength1(Eval("現住所").ToString())%>'
                                Tooltip='<%#Eval("現住所")%>' /></div>
                          
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="出身地">
                        <ItemTemplate>
                              <div style="width:180px;overflow:hidden;white-space:normal">
                                <asp:Label
                                    runat="server"
                                    id="lbl_出身地"
                                    Text='<%#Eval("出身地")%>'
                                    Tooltip='<%#Eval("出身地")%>' />
                            </div>
                            
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                  </Columns>
                  
                  
<PagerStyle CssClass="pgr"></PagerStyle>

<AlternatingRowStyle CssClass="alt"></AlternatingRowStyle>
                  
                  
                </asp:GridView> 
            </div>
    
    </div>
    
    <div class="detail-admin-row">
        <div class="btn_back">
            &nbsp;
         </div>
         <div class="btn_next">
         
           <asp:Button ID="btn_確認"  runat="server" Text="確認" OnClick="btn_確認_Click"  CssClass="btn" />
         </div>
    </div>

</div>
<div>&nbsp;</div>
  <br /> 
       
</asp:Content>

